<?php

/**
 * 默认控制器
 */
class Controller_Default extends Controller_Abstract
{
    function actionIndex()
    {
        $this->_view['topics'] = Topic::find()
            ->top(Q::ini('appini/homepage/topics_num'))
            ->order('order_pos DESC')
            ->getAll();

        $this->_view['activities'] = Activity::find()
            ->top(Q::ini('appini/homepage/activities_num'))
            ->order('order_pos DESC')
            ->getAll();
    }

    function actionLogout()
    {
        $this->_app->cleanCurrentUser();
        return $this->_redirectMessage(
            '提示信息',
            '您已退出登录状态，现在将以游客身份转入退出前页面。',
            url('default/index'),
            Q::ini('appini/site/message_delay'),
            UCenterClient::user()->synLogout()
        );
    }

    function action403()
    {
        return $this->_redirectMessage(
            '提示信息',
            '您没有权限访问该功能，现在将转入登录页面。',
            Q::ini('appini/passport/login_url'),
            Q::ini('appini/site/message_delay')
        );
    }

}

